import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Admin
 * Date: 2022-11-11
 * Time: 17:50
 */
public class Demo1 {
    public static void func(int n, int[] array) {
        int left = 0;//偶数
        int right = 1;//奇数

        while(left < array.length && right < array.length) {

            if(array[left] % 2 == 0 ) {
                left+=2;
                continue;
            }

            if(array[right] % 2 == 1) {
                right+=2;
                continue;
            }

            int tmp = array[left];
            array[left] = array[right];
            array[right] = tmp;
        }
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();
        int[] array = new int[n];
        for(int i = 0; i < n; i++) {
            array[i] = scan.nextInt();
        }

        func(n,array);

        for(int i = 0; i < n; i++) {
            System.out.print(array[i]+" ");
        }
    }
}
